package com.googlecode.bip.dao;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
import javax.naming.NamingException;
import com.googlecode.bip.entity.IGenericUser;
import com.googlecode.bip.entity.IReferent;

/**
 * DAO for {@link IReferent}
 */
public interface ReferentDAO extends Serializable
{
    /**
     * Returns an {@link IReferent}
     *
     * @param idreferent idreferent (iduser)
     * @return an {@link IReferent} or null if idreferent does not match with a valid {@link IReferent}
     * @throws NamingException if any
     * @throws SQLException if any
     * @see IReferent#getIdReferent()
     * @see IGenericUser#getIdUser()
     */
    public IReferent findReferent( int idreferent )
        throws NamingException, SQLException;

    /**
     * Returns list of all {@link IReferent}
     *
     * @return list of all {@link IReferent}
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public List<IReferent> findReferents()
        throws NamingException, SQLException;

    /**
     * Create a new {@link IReferent}
     *
     * @param referentPublicName        Referent public name; must be unique in database
     * @param referentPublicDescription Referent public description;A free HTML String.
     * @param referentUserName          Referent login name; must be unique in database
     * @param referentUserPassword      Referent login password
     * @return a new {@link IReferent} if user created, null otherwise
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public IReferent insertReferent(
            String referentPublicName,
            String referentPublicDescription,
            String referentUserName,
            String referentUserPassword
            )
        throws NamingException, SQLException;

    /**
     * Delete an {@link IReferent}
     *
     * @param idreferent idreferent to delete
     * @return true if {@link IReferent} has been deleted, false on failure
     * @throws NamingException if any
     * @throws SQLException if any
     */
    public boolean deleteReferent( int idreferent )
        throws NamingException, SQLException;

}

